﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Configuration;
using System.Windows.Media;
using Business.Compta;

namespace DAO
{
    public class MainDAO
    {
        public static OleDbConnection OpenComptaConnection()
        {
            ConnectionStringSettingsCollection connStringCol =
                ConfigurationManager.ConnectionStrings;
            ConnectionStringSettings connString = connStringCol["ComptaDb"];
            OleDbConnection conn = new OleDbConnection(connString.ConnectionString);
            conn.Open();
            return conn;
        }

        public static OleDbConnection OpenCdcConnection()
        {
            ConnectionStringSettingsCollection connStringCol =
                ConfigurationManager.ConnectionStrings;
            ConnectionStringSettings connString = connStringCol["CdcDb"];
            OleDbConnection conn = new OleDbConnection(connString.ConnectionString);
            conn.Open();
            return conn;
        }


        public static byte[] ReadFully(System.IO.Stream input)
        {
            byte[] buffer = new byte[16 * 1024];
            using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
            {
                int read;
                while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
                {
                    ms.Write(buffer, 0, read);
                }
                return ms.ToArray();
            }
        }

        public static string USERS = "USERS";
        public static string USERS_ACCOUNT = "USERS_ACCOUNT";
        public static string COMPTA_LINE_SUP = "COMPTA_LINE_SUP";

        public static string ID = "ID";
        public static string ID_LINE = "ID_LINE";
        public static string ID_ACCOUNT = "ID_ACCOUNT";
        public static string ID_CATEG = "ID_CATEG";
        public static string ID_USER = "ID_USER";
        public static string AMOUNT = "AMOUNT";
        public static string COMMENT = "COMMENT";
        public static string FDATE = "FDATE";
        public static string IDATE = "IDATE";
        public static string MDATE = "MDATE";

        public static string CATEGORIES_PER_USER = "CATEGORIES_ACCOUNT";
        public static string PERCENT = "PERCENT_VALUE";

        public static string CATEGORIES = "CATEGORIES";
        public static string CATEGORY_COLOR = "CATEGORY_COLOR";
        public static string CATEGORY_NAME = "CATEGORY_NAME";
        public static string IS_CHECKED = "IS_CHECKED";
        public static string IS_PERMANENT = "IS_PERMANENT";
        public static string IS_SUP = "IS_SUP";
        
        
        
 }
}
